package cn.com.blueInfo.HaiYuan.business.journal.controller;

import cn.com.blueInfo.HaiYuan.business.journal.service.JournalBaseService;
import cn.com.blueInfo.utils.result.BootstrapTable;
import cn.com.blueInfo.utils.result.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 日记账基本服务
 * @ClassName: JournalBaseController
 * @author suxch
 * @date 2020年10月8日  上午8:23:53
 */
@RestController
@RequestMapping("operation/business/journalBase")
public class JournalBaseController {

    @Autowired
    private JournalBaseService journalService;

    /**
     * 分页查询日记账基本信息
     * @Title: queryJournalBaseInfoByPage
     * @param request
     * @return BootstrapTable
     * @throws
     */
    @RequestMapping("/queryJournalBaseInfoByPage.do")
    public BootstrapTable queryJournalBaseInfoByPage(HttpServletRequest request) {
        return journalService.queryJournalBaseDataByPage(request);
    }

    /**
     * 新增日记账基本信息
     * @Title: addJournalBaseInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/addJournalBaseInfo.do")
    public ResultInfo addJournalBaseInfo(HttpServletRequest request) {
        return journalService.addJournalBaseData(request);
    }

    /**
     * 更新日记账基本信息
     * @Title: replaceJournalBaseInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/replaceJournalBaseInfo.do")
    public ResultInfo replaceJournalBaseInfo(HttpServletRequest request) {
        return journalService.replaceJournalBaseInfo(request);
    }

    /**
     * 删除日记账基本信息
     * @Title: removeJournalBaseInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/removeJournalBaseInfo.do")
    public ResultInfo removeJournalBaseInfo(HttpServletRequest request) {
        return journalService.removeJournalBaseInfo(request);
    }

    /**
     * 查询合计日记账基本信息
     * @Title: querySumJournalBaseInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/querySumJournalBaseInfo.do")
    public ResultInfo querySumJournalBaseInfo(HttpServletRequest request) {
        return journalService.querySumJournalBaseInfo(request);
    }

    /**
     * 查询月份信息
     * @Title: queryMonthInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/queryMonthInfo.do")
    public ResultInfo queryMonthInfo(HttpServletRequest request) {
        return journalService.queryMonthData(request);
    }

    /**
     * 导出Excel文件
     * @Title: exportExcelFile
     * @param request
     * @param response
     * @return void
     * @throws
     */
    @RequestMapping("/exportExcelFile.do")
    public void exportExcelFile(HttpServletRequest request, HttpServletResponse response) {
        journalService.exportExcelFile(request, response);
    }

    /**
     * 添加上月结余信息
     * @Title: addLastMonthBalanceInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/addLastMonthBalanceInfo.do")
    public ResultInfo addLastMonthBalanceInfo(HttpServletRequest request) {
        return journalService.addLastMonthBalanceData(request);
    }

    /**
     * 获取分类汇总日期信息
     * @Title: querySumDateInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/querySumDateInfo.do")
    public ResultInfo querySumDateInfo(HttpServletRequest request) {
        return journalService.querySumDateData(request);
    }

    /**
     * 查询分类汇总信息
     * @Title: queryItemsSumInfo
     * @param request
     * @return BootstrapTable
     * @throws
     */
    @RequestMapping("/queryItemsSumInfo.do")
    public BootstrapTable queryItemsSumInfo(HttpServletRequest request) {
        return journalService.queryItemsSumData(request);
    }

    /**
     * 配合详情表做查询时的金额汇总
     * @Title: queryJournalBaseItemsSumInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/queryJournalBaseItemsSumInfo.do")
    public ResultInfo queryJournalBaseItemsSumInfo(HttpServletRequest request) {
        return journalService.queryJournalBaseItemsSumData(request);
    }

    /**
     * 重算每月结余信息
     * @Title: rerunMonthlyBalanceInfo
     * @param request
     * @return ResultInfo
     * @throws
     */
    @RequestMapping("/rerunMonthlyBalanceInfo.do")
    public ResultInfo rerunMonthlyBalanceInfo(HttpServletRequest request) {
        return journalService.rerunMonthlyBalanceData(request);
    }
}
